home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / killed.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  12.4 KB  |  564 lines

  1. //println "killed.scr"
  2.  
  3. // Location values:
  4. // -2 false positive: should return a miss
  5. // -1 General
  6. // 0  head
  7. // 1  helmet
  8. // 2  neck
  9. // 3  upper torso
  10. // 4  middle torso
  11. // 5  lower torso
  12. // 6  pelvis
  13. // 7  right upper arm
  14. // 8  left upper arm
  15. // 9  right upper leg
  16. // 10 left upper leg
  17. // 11 right lower arm
  18. // 12 left lower arm
  19. // 13 right lower leg
  20. // 14 left lower leg
  21. // 15 right hand
  22. // 16 left hand
  23. // 17 right foot
  24. // 18 left foot
  25.  
  26. //println "Killed by " self.fact.damage " damage in location " self.fact.location
  27.  
  28. waitexec anim/smoking.scr::SmokeRemoveCigarette
  29.  
  30. //self.normal_health = 0 // He is dead
  31.  
  32. // Make Some Damage Smokey Poofs
  33. if(0) // This is handled in the code, no need to do it again here
  34. {
  35.     local.vec2 = self.fact.direction
  36.     local.vec2[0] = local.vec2[0] * -1
  37.     local.vec2[1] = local.vec2[1] * -1
  38.     local.vec2[2] = local.vec2[2] * -1
  39.     self damagepuff self.fact.position local.vec2
  40. }
  41.  
  42. // Need a fast blendtime so the animation begins snappily
  43. self.blendtime = 0.3
  44.  
  45.  
  46. // Facial animation/sound
  47. // Boon 9-11-01 Moved this back up so it would happen for the special death animation case  (moved that back up because
  48. // calling two animations in one frame is an error.  Jason had moved it to the bottom and I'm not sure if the condition
  49. // that required that is gone now.  If death sounds stop playing then this may be the culprit.
  50. self setsay death_generic    // Death facial animation/sound
  51.  
  52.  
  53. ////////
  54. // Pop off the helmet
  55. if ( (self.fact.location == 0) || (self.fact.location == 1) )
  56. {
  57.     self pophelmet
  58. }
  59.  
  60. // Special death animation
  61. if (self.deathanim != NIL)
  62. {
  63. //    println "Playing special death animation " self.deathanim
  64.     self setmotionanim self.deathanim
  65.     self waittill flaggedanimdone
  66.     end
  67. }
  68.  
  69.  
  70.  
  71. //exec global/sethelmetfalloff.scr "false"
  72.  
  73. // The direction the bullet/damage came from is useful more often than not.
  74. local.yaw = self GetLocalYawFromVector self.fact.direction
  75.  
  76. // Explosive deaths give a -1 hit location
  77. if (self.fact.location == -1)
  78. {
  79.     //println "Unknown location, assuming explosive death"
  80.     // If we really got it bad, play a flying through the air animation
  81.     if (self.fact.damage > 75)
  82.     {
  83.         local.randnum = randomint 100
  84.         if (local.randnum > 70)
  85.         {
  86.             self setmotionanim death_grenade_high
  87.         }
  88.         if (local.yaw > -45 && local.yaw < 45)
  89.         {
  90.             self setmotionanim death_backgrenade
  91.         }
  92.         else
  93.         {
  94.             self setmotionanim death_grenade
  95.         }
  96.         local.randnum = randomint 100
  97.         if (local.randnum > 40)
  98.         {
  99.             self pophelmet
  100.         }
  101.     }
  102.     else if (self.fact.damage > 50)
  103.     {
  104.         if (local.yaw > -45 && local.yaw < 45)
  105.         {
  106.             self setmotionanim death_back
  107.         }
  108.         else if (local.yaw > 45 && local.yaw < 135)
  109.         {
  110.             self setmotionanim death_right
  111.         }
  112.         else if (local.yaw > -135 && local.yaw < -45)
  113.         {
  114.             self setmotionanim death_left
  115.         }
  116.         else
  117.         {
  118.             self setmotionanim death_run
  119.         }
  120.         local.randnum = randomint 100
  121.         if (local.randnum > 60)
  122.         {
  123.             self pophelmet
  124.         }
  125.     }
  126.     else
  127.     {
  128.         //println "falling down"
  129.         local.randnum = randomint 100
  130.         if (local.randnum > 70)
  131.         {
  132.             self setmotionanim death_crotch
  133.         }
  134.         else if (local.randnum > 30)
  135.         {
  136.             self setmotionanim death_chest
  137.         }
  138.         else
  139.         {
  140.             self setmotionanim death_frontchoke
  141.         }
  142.     }
  143.     self waittill flaggedanimdone
  144.     self.position = "dead"
  145.     end
  146. }
  147.  
  148.  
  149. switch (self.position)
  150. {
  151. dead:
  152.     break
  153. knees:
  154. crouch:
  155. crouchwalk:
  156.     if (local.yaw > 135 && local.yaw < 225)
  157.     {
  158.         self setmotionanim death_frontcrouch
  159.     }
  160.     else
  161.     {
  162.         switch(self.weapontype)
  163.         {
  164.             grenade:
  165.     //            println "Fatal Shot While On Knees/Has Grenade"
  166.                  //self setmotionanim grenade_pain_kneestodeath        // don't have
  167.                 self setmotionanim rifle_pain_kneestodeath            // temp default
  168.                 break
  169.             rifle:
  170.     //            println "Fatal Shot While On Knees/Has Rifle"
  171.                 self setmotionanim rifle_pain_kneestodeath
  172.                 break
  173.             smg:
  174.     //            println "Fatal Shot While On Knees/Has SMG"
  175.                  self setmotionanim thompson_pain_kneestodeath
  176.                 break
  177.             bazooka:
  178.     //            println "Fatal Shot While On Knees/Has Bazooka"
  179.                 //self setmotionanim bazooka_pain_kneestodeath        // Don't have
  180.                 self setmotionanim rifle_pain_kneestodeath        // Temp default
  181.                 break
  182.             default:
  183.     //            println "Fatal Shot While On Knees/Default Case - this is a bug in killed.scr"
  184.                 self setmotionanim rifle_pain_kneestodeath        // Play the default
  185.                 break
  186.         }
  187.     }
  188.     break
  189.  
  190. prone:
  191. // Need different animations for prone!!!!
  192. floor:
  193.     switch(self.weapontype)
  194.     {
  195.         grenade:
  196. //            println "Fatal Shot While On Floor/Has Grenade"
  197.             //self setmotionanim grenade_pain_floortodeath        // Don't have
  198.             self setmotionanim death_prone        // Temp default
  199.             break
  200.         rifle:
  201. //            println "Fatal Shot While On Floor/Has Rifle"
  202.             self setmotionanim death_prone
  203.             break
  204.         smg:
  205. //            println "Fatal Shot While On Floor/Has SMG"
  206.             self setmotionanim death_prone
  207.             break
  208.         bazooka:
  209. //            println "Fatal Shot While On Floor/Has Bazooka"
  210.              //self setmotionanim bazooka_pain_floortodeath        // Don't have
  211.             self setmotionanim death_prone        // Temp default
  212.             break
  213.         default:
  214. //            println "Fatal Shot While On Floor/Default Case - this is a bug in killed.scr"
  215.             self setmotionanim death_prone        // Default
  216.             break
  217.     }
  218.     break
  219.  
  220. run:
  221.     local.forwardvelocity = self.velocity * self.forwardvector
  222.     println "Forward velocity: " local.forwardvelocity
  223.     if ( local.forwardvelocity > 130 )
  224.     {
  225.         if ( (local.yaw > -45) && (local.yaw < 45) && (self.fact.damage > 50) )
  226.         {
  227.             local.randnum = randomint 100
  228.             if (local.randnum > 70)
  229.             {
  230.                 self setmotionanim death_knockedup
  231.             }
  232.             else
  233.             {
  234.                 self setmotionanim death_chest
  235.             }
  236.         }
  237.         else
  238.         {
  239.             self setmotionanim death_run
  240.         }
  241.         local.randnum = randomint 100
  242.         if (local.randnum > 60)
  243.         {
  244.             self pophelmet
  245.         }
  246.         break
  247.     }
  248.     // else flow through to the stand case
  249. walk:
  250. stand:
  251. crouchrun:
  252. pronewalk:
  253. default:
  254.     switch (self.fact.location)
  255.     {
  256.     // Lower torso)
  257.     case 6: // pelvis
  258.     case 5: // lower torso
  259.         //println "Fatal Stomach Shot"
  260.  
  261.         // If the blow came from in front, fall back
  262.         local.randnum = randomint 100
  263.         if ( (local.yaw > -45) && (local.yaw < 45) && (local.randnum > 40) )
  264.         {
  265.             self setmotionanim death_back
  266.         }
  267.         else if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 70) )
  268.         {
  269.             local.randnum = randomint 100
  270.             if (local.randnum > 50)
  271.             {
  272.                 // knockedup is good for shots from behind in the lower body, or in front in the upper.
  273.                 self setmotionanim death_knockedup
  274.             }
  275.             else
  276.             {
  277.                 self setmotionanim death_run
  278.             }
  279.         }
  280.         else
  281.         {
  282.             local.randnum = randomint 100
  283.             if (local.randnum > 40)
  284.             {
  285.                 self setmotionanim death_crotch
  286.             }
  287.             else
  288.             {
  289.                 self setmotionanim death_chest
  290.             }
  291.         }
  292.         break
  293.  
  294.     // Upper torso
  295.     case 4: // middle torso
  296.     case 3: // upper torso
  297.         //println "Fatal Chest Shot"
  298.         // If the blow came from in front, fall back
  299.         local.randnum = randomint 100
  300.         if ( (local.yaw > -45) && (local.yaw < 45) && (local.randnum > 40) )
  301.         {
  302.             if (local.randnum > 70)
  303.             {
  304.                 // knockedup is good for shots from behind in the lower body, or in front in the upper.
  305.                 self setmotionanim death_knockedup
  306.             }
  307.             else
  308.             {
  309.                 self setmotionanim death_back
  310.             }
  311.         }
  312.         else if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 60) )
  313.         {
  314.             self setmotionanim death_run
  315.         }
  316.         else
  317.         {
  318.             local.randnum = randomint 100
  319.             if (local.randnum > 70)
  320.             {
  321.                 self setmotionanim death_frontchoke
  322.             }
  323.             else if (local.randnum > 40)
  324.             {
  325.                 self setmotionanim death_shoot
  326.             }
  327.             else
  328.             {
  329.                 self setmotionanim death_chest
  330.             }
  331.         }
  332.         break
  333.  
  334.     // Neck - choke
  335.     case 2: // neck
  336.         //Println "fatal neck shot"
  337.         local.randnum = randomint 100
  338.         if (local.randnum > 50)
  339.         {
  340.             self setmotionanim death_frontchoke
  341.         }
  342.         else
  343.         {
  344.             self setmotionanim death_choke
  345.         }
  346.         break
  347.  
  348.     // Head
  349.     case 1: // helmet
  350.     case 0: // head
  351.         //Println "fatal head shot"
  352.  
  353. //        exec global/sethelmetfalloff.scr "true"
  354.  
  355.         local.randnum = randomint 100
  356.         if ( (local.yaw > -45) && (local.yaw < 45) && (local.randnum > 50) )
  357.         {
  358.             self setmotionanim death_back
  359.         }
  360.         else if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 70) )
  361.         {
  362.             self setmotionanim death_head_flyforward
  363.         }
  364.         else
  365.         {
  366.             local.randnum = randomint 100
  367.             if (local.randnum > 80)
  368.             {
  369.                 self setmotionanim death_headpistol
  370.             }
  371.             else if (local.randnum > 60)
  372.             {
  373.                 self setmotionanim death_twist
  374.             }
  375.             else if (local.randnum > 40)
  376.             {
  377.                 self setmotionanim death_shoot
  378.             }
  379.             else if (local.randnum > 20)
  380.             {
  381.                 self setmotionanim death_fall_to_knees
  382.             }
  383.             else
  384.             {
  385.                 self setmotionanim death_collapse
  386.             }
  387.         }
  388.         break
  389.  
  390.     // Right arm - we could fudge it here so you can't kill someone by shooting them
  391.     // in the arm...
  392.     case 7: // right upper arm
  393.     case 11: // right lower arm
  394.     case 15: // right hand
  395.         //println "Fatal right arm shot"
  396.         local.randnum = randomint 100
  397.         if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 50) )
  398.         {
  399.             self setmotionanim death_twist
  400.         }
  401.         else
  402.         {
  403.             local.randnum = randomint 100
  404.             if (local.randnum > 70)
  405.             {
  406.                 self setmotionanim death_fall_back
  407.             }
  408.             else if (local.randnum > 40)
  409.             {
  410.                 self setmotionanim death_shoot
  411.             }
  412.             else
  413.             {
  414.                 self setmotionanim death_chest
  415.             }
  416.         }
  417.         break
  418.  
  419.     // Left  arm - we could fudge it here so you can't kill someone by shooting them
  420.     // in the arm...
  421.     case 8: // left upper arm
  422.     case 12: // left lower arm
  423.     case 16: // left hand
  424.         //println "Fatal left arm shot"
  425.         local.randnum = randomint 100
  426.         if ( (local.yaw > -45) && (local.yaw < 45) && (local.randnum > 50) )
  427.         {
  428.             self setmotionanim death_twist
  429.         }
  430.         else
  431.         {
  432.             local.randnum = randomint 100
  433.             if (local.randnum > 70)
  434.             {
  435.                 self setmotionanim death_fall_back
  436.             }
  437.             else if (local.randnum > 40)
  438.             {
  439.                 self setmotionanim death_shoot
  440.             }
  441.             else
  442.             {
  443.                 self setmotionanim death_chest
  444.             }
  445.         }
  446.         break
  447.  
  448.     // Right leg - we could fudge it here so you can't kill someone by shooting them
  449.     // in the leg...
  450.     case 9: // right upper leg
  451.     case 13: // right lower leg
  452.     case 17: // right foot
  453.         //println "Fatal right leg shot"
  454.         local.randnum = randomint 100
  455.         if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 50) )
  456.         {
  457.             self setmotionanim death_knockedup
  458.         }
  459.         else
  460.         {
  461.             if (local.randnum > 70)
  462.             {
  463.                 self setmotionanim death_twist
  464.             }
  465.             else if (local.randnum > 40)
  466.             {
  467.                 self setmotionanim death_shoot
  468.             }
  469.             else
  470.             {
  471.                 self setmotionanim death_collapse
  472.             }
  473.         }
  474.         break
  475.  
  476.     // Left leg - we could fudge it here so you can't kill someone by shooting them
  477.     // in the leg...
  478.     case 10: // left upper leg
  479.     case 14: // left lower leg
  480.     case 18: // left foot
  481.         //println "Fatal left leg shot"
  482.         local.randnum = randomint 100
  483.         if ( (local.yaw > 135) && (local.yaw < 225) && (local.randnum > 50) )
  484.         {
  485.             self setmotionanim death_knockedup
  486.         }
  487.         else
  488.         {
  489.             if (local.randnum > 70)
  490.             {
  491.                 self setmotionanim death_fall_to_knees
  492.             }
  493.             else if (local.randnum > 40)
  494.             {
  495.                 self setmotionanim death_shoot
  496.             }
  497.             else
  498.             {
  499.                 self setmotionanim death_collapse
  500.             }
  501.         }
  502.         break
  503.  
  504.     default:
  505. //println "Warning: Fatal Shot in unknown body part!  (Part " self.fact.location ")"
  506.         self setmotionanim death_chest
  507.         break
  508.     }
  509. }
  510.  
  511. self waittill flaggedanimdone
  512. self.position = "dead"
  513.  
  514. // Helmet popped off depending on where you got hit, not on some variable anymore.
  515. //if (self.losehelmet == true)
  516. //{
  517. //    // Ping the helmet off
  518. //    //println "ejecting helmet"
  519. //    self pophelmet
  520. //}
  521.  
  522. end
  523.  
  524.  
  525. //---------------------------
  526. killed_chair:
  527.  
  528.     // Facial animation/sound
  529.     self setsay death_generic    // Death facial animation/sound
  530.  
  531.  
  532.     // Pop off the helmet
  533.     if ( (self.fact.location == 0) || (self.fact.location == 1) )
  534.     {
  535.         self pophelmet
  536.     }
  537.  
  538.     // Special death animation
  539.     if (self.deathanim != NIL)
  540.     {
  541.     //    println "Playing special death animation " self.deathanim
  542.         self setmotionanim self.deathanim
  543.         self waittill flaggedanimdone
  544.         end
  545.     }
  546.  
  547.  
  548.     // Play either death forward or backwards depending on the direction of the shot
  549.     local.yaw = self GetLocalYawFromVector self.fact.direction
  550.  
  551.     if ( (local.yaw > 90) && (local.yaw < 270) )
  552.     {
  553.         self setmotionanim chair_death_forwards
  554.     }
  555.     else
  556.     {
  557.         self setmotionanim chair_death_backwards
  558.     }
  559.  
  560.     self waittill flaggedanimdone
  561.     self.position = "dead"
  562.  
  563. end
  564.